/**
 **_______Ivo 输入值对象集处理_______
 */
Ivo=function(s, t) 
{
	this.service =s;//服务
	if(t ==null)
	{
		t ="0";
	}
	this.type =t;//服务类型,0静态服务1动态服务
	this.params =[];
	this.paramtypes =[];
	this.popup_waiting =false;//弹出等待框，在执行过程中不能关闭
	this.popoff_manual =true;//弹出等待框，在执行过程中不能关闭，完成后是否自动关闭。
	this.waiting = true;//是否出现等待框
	this.action_trace =true;//是否记录跟踪
	this.waiting_div =null;//指定等待框出现的位置，此处等待框DIV的id
	this.async =true;//是否异步
	this.unsecuritied =false;//是否需要加密
	/**有些参数不需要传递给服务端进行处理，但在返回的时候需要用到。那这部分参数可以放在此数组变量中。（目前只提供简单的参数）*/
	this.clientParams =[];
	this.single =true;//单一运行的（在较短时间内部允许多次运行，防止用户连续点击事件出现），默认为单一运行
	this.post_proxy =null;//提交的处理程序代理，默认为 JSON_REQUEST/JSON_REQUEST2
	this.ver =1;//默认为版本1
};

Ivo.prototype.setService=function(s)
{
	this.service =s;
};

Ivo.prototype.reset=function()
{
	this.params =[];
	this.paramtypes =[];
};

Ivo.prototype.addParam=function(param)
{
	this.params.push(param);
	this.paramtypes.push("param");
};

Ivo.prototype.setWaiting=function(bwaiting)
{
	this.waiting =bwaiting;
};
Ivo.prototype.setActionTrace=function(baction_trace)
{
	this.action_trace =baction_trace;
};

Ivo.prototype.add=function(t, v)
{
	this.set(t, v);
};
/*把整个Form的值插入调用参数集
*/
Ivo.prototype.setFormData=function(form)
{
	if(form)
		form =$(form);
	else
		form =document;
	var fdata =$E.getFormData(form);
	if(fdata)
	{
		for(i=0; i<fdata.length; i++)
		{
			this.set(fdata[i].name, fdata[i].value);
		}
	}
}
;
/**
设置客户端中转参数，此参数不传到后台
*/
Ivo.prototype.cset=function(t, v)
{
	var param =new Param(t, v);
	this.clientParams.push(param);
}
;

/**
获取客户端中转参数
*/
Ivo.prototype.cget=function(n, dfv)
{
	var s =null;
	for(var i=0; i<this.clientParams.length; i++)
	{
		if(this.clientParams[i].name.toLowerCase() ==n.toLowerCase())
		{
			s =this.clientParams[i].value;
			break;
		}
	}
	if(s ==null)
	{
		s =dfv;
	}
	if(typeof(s) =="undefined" || s =="undefined")
	{
		s ="";
	}
	return s;
};

Ivo.prototype.set=function(t, v)
{
	// console.log("t",t,"v", typeof v, typeof DataSet, typeof Row)
	if(v ==null)
		return;
	
	if(v instanceof DataSet)
	{
		// console.log("执行在这里")
		this.addDataSet(t, v);
	}
	else if(v instanceof Row)
	{
		// console.log("这是一个row")
		this.addRow(t, v);
	}
	else
	{
		v =""+v;
		if(v)
		{
			//判断是否重复，如果已经存在就覆盖
			var exist =false;
			for(var i=0; i<this.params.length; i++)
			{
				if(this.params[i].name.toLowerCase() ==t.toLowerCase())
				{
					exist =true;
					this.params[i].value =v;
				}
			}
			if(!exist)
			{
				var param =new Param(t, v);
				this.params.push(param);
				this.paramtypes.push("param");
			}
		}
	}
};
Ivo.prototype.remove=function(t)
{
	for(var i=0; i<this.params.length; i++)
	{
		if(this.params[i].name.toLowerCase() ==t.toLowerCase())
		{
			this.params.splice(i,1);
			this.paramtypes.splice(i,1);
			break;
		}
	}
};
Ivo.prototype.addDataSet=function(n, d)
{
	console.log("这个执行了")
	if(n.toLowerCase().indexOf("dataset:") !=-1)
	{
		n =n.substring("dataset:".length);
	}
	//判断是否重复，如果已经存在就覆盖
	var exist =false;
	for(var i=0; i<this.params.length; i++)
	{
		if(this.params[i].name.toLowerCase() ==n.toLowerCase())
		{
			exist =true;
			this.params[i].value =d;
		}
	}
	if(!exist)
	{
		var p =new Param(n, d);
		this.params.push(p);
		this.paramtypes.push("dataset");
	}
};

Ivo.prototype.addRow=function(n, r)
{
	//判断是否重复，如果已经存在就覆盖
	var exist =false;
	for(var i=0; i<this.params.length; i++)
	{
		if(this.params[i].name.toLowerCase() ==n.toLowerCase())
		{
			exist =true;
			this.params[i].value =r;
		}
	}
	if(!exist)
	{
		var p =new Param(n, r);
		this.params.push(p);
		this.paramtypes.push("row");
	}
};
Ivo.prototype.get=function(n, dfv)
{
	if(!isDefined(dfv))
	{
		dfv ="";
	}
	var s =null;
	for(var i=0; i<this.params.length; i++)
	{
		if(this.paramtypes[i] =="param" && this.params[i].name.toLowerCase() ==n.toLowerCase())
		{
			s =this.params[i].value.replace(/\"/g,"\\\"").replace(/\+/g,"01AA01AA").replace(/\n/g,"\\n");
			break;
		}
	}
	if(s ==null || s =="")
	{
		s =dfv;
	}

	if(typeof(s) =="undefined" || s =="undefined")
	{
		s =dfv;
	}
	return s;
};

Ivo.prototype.getRow=function(n)
{
	var s =null;
	for(var i=0; i<this.paramtypes.length; i++)
	{
		if(this.paramtypes[i] =="row")
		{
			var row =this.params[i];
			if(row.name.toLowerCase() ==n.toLowerCase())
			{
				s =this.params[i].value;
				break;
			}
		}
	}
	return s;
}
;
Ivo.prototype.getDataSet=function(n)
{
	var s =null;
	for(var i=0; i<this.params.length; i++)
	{
		if(this.paramtypes[i] =="dataset")
		{
			var row =this.params[i];
			if(row.name.toLowerCase() ==n.toLowerCase())
			{
				s =this.params[i].value;
				break;
			}
		}
	}
	return s;
};
Ivo.prototype.toString=function()
{
	var s ="service="+this.service+"; type="+this.type;
	s +="\n{";
	for(var i=0; i<this.params.length; i++)
	{
		s +="\n"+this.params[i].toString();
	}
	s +="\n}";
	return s;
};

Ivo.prototype.length=function()
{
	return this.params.length;
};

Ivo.prototype.toJson=function()
{
	var sivo ='{';
	var sDefaultParams ="";
	sivo +='"service":"'+this.service+'"'
	if(this.type ==1)
	{
		sivo +=',"service_type":"'+this.type+'"';
	}
	for(var i=0; i<this.params.length; i++)
	{
		if(this.paramtypes[i] =="param")
		{
			if(sDefaultParams !="")
				sDefaultParams +=",";
//			sDefaultParams +=this.params[i].toJson();
			var str="\""+this.params[i].name.toLowerCase()+"\":\""+this.params[i].value.replace(/\"/g,"\\\"").replace(/\+/g,"01AA01AA").replace(/\n/g,"\\n")+"\"";
			sDefaultParams +=str;
		}
		else if(this.paramtypes[i] =="row")
		{
			var row =this.params[i];
			sivo +=",\"row:"+row.name.toLowerCase()
				+"\":"+row.value.toJson();
		}
		else if(this.paramtypes[i] =="dataset")
		{
			var ds =this.params[i];
			sivo +=",\"dataset:"+ds.name.toLowerCase()+"\":["+ds.value.toJson()+"]";
		}
	}
	if(sDefaultParams !="")
	{
		sivo +=",\"row:params\":{"+sDefaultParams+"}";
	}
	sivo +="}";
	sivo =sivo.replace(/%/g, "%25");
	return sivo;
};

Ivo.prototype.toJson2=function()
{
	var sivo ='{';
	sivo +='"service":"'+this.service+'"'
	if(this.type ==1)
	{
		sivo +=',"service_type":"'+this.type+'"';
	}
	for(var i=0; i<this.params.length; i++)
	{
		var param =this.params[i];
		if(param.value instanceof Row)
		{
			sivo +=",\""+param.name.toLowerCase()
				+"\":"+param.value.toJson();
		}
		else if(param.value instanceof DataSet)
		{
			var ds =this.params[i];
			sivo +=",\""+ds.name.toLowerCase()+"\":["+ds.value.toJson()+"]";
		}
		else
		{
			sivo +=",\""+this.params[i].name.toLowerCase()+"\":\""+this.params[i].value.replace(/\"/g,"\\\"").replace(/\+/g,"01AA01AA").replace(/\n/g,"\\n")+"\"";
		}
	}
	sivo +="}";
	sivo =sivo.replace(/%/g, "%25");
	return sivo;
};

Ivo.prototype.load=function(jsonstring)
{
	try
	{
		json =eval("("+jsonstring+")");
		this.service =json.service;
		this.type =json.service_type;
		for(var item in json)
		{   
			if(typeof json[item] =='string')
			{
				if(item =="service" || item =="service_type")
					continue;
				var m =new Param(item, json[item]);
				this.addParam(m);
			}
			else if(typeof json[item] =='object')
			{
				var json2 =json[item];
				var row =null;
				var dataset =null;
				for(var item2 in json2)
				{
					if(typeof json2[item2] =='string')
					{//Row
						if(row ==null)
						{
							//alert(item);
							if(item =="row:params")
							{
								var m =new Param(item2, json2[item2]);
								this.addParam(m);
								continue;
							}
							else
							{
								row =new Row();
								this.addRow(item, row);
							}
						}
						row.put(item2, json2[item2]);
					}
					else if(typeof json2[item2] =='object')
					{//dataset
						var json3 =json2[item2];
						if(dataset ==null)
						{
							dataset =new DataSet();
							this.addDataSet(item, dataset);
						}
						var row2 =null;
						for(var item3 in json3)
						{
							if(typeof json3[item3] =='string')
							{
								if(row2 ==null)
								{
									row2 =new Row();
									dataset.addRow(row2);
								}
								row2.put(item3, json3[item3]);
							}
						}
					}
				}
			}
		 }  
	}
	catch(e)
	{
		//alert(e+":::::::::1");
		uni.showToast({
			title:e,
			icon:'none',
			mask:true,
			duration:2000,
			position:'center'
		})
	}
}

/**
 **_______Ovo 输出值对象集处理_______
 */
Ovo=function(sJson, ivo)
{
	this.ivo =ivo;//输入值对象
	this.code =0;//错误号
	this.msg ="";//提示信息
	this.exp ="";//异常信息
	this.service ="";//服务名称
	this.params =[];//Ovo.params;
	this.paramtypes =[];//ovo.paramtypes;
	this.result =null;
	this.iServiceType =0;//服务类型 1动态服务 0静态服务
	try
	{
		json =eval("("+sJson+")");
		this.service =json.service;
		this.code =json.code;
		if(isDefined(json.msg))
		{
			this.msg =json.msg;
		}
		if(isDefined(json.exp))
		{
			this.exp =json.exp;
		}
		for(var item in json)
		{   
			if(typeof json[item] =='string')
			{
				var m =new Param(item, json[item]);
				this.addParam(m);
			}
			else if(typeof json[item] =='object')
			{
				var json2 =json[item];
				var row =null;
				var dataset =null;
				for(var item2 in json2)
				{
					if(json2[item2] ==null)
						continue;
					if(typeof json2[item2] =='string')
					{//Row
						if(row ==null)
						{
							//alert(item);
							row =new Row();
							this.addRow(item, row);
						}
						//alert(item2+"="+json2[item2]);
						row.put(item2, json2[item2]);
					}
					else if(typeof json2[item2] =='object')
					{//dataset
						var json3 =json2[item2];
						if(dataset ==null)
						{
							dataset =new DataSet();
							this.addDataSet(item, dataset);
						}
						var row2 =null;
						for(var item3 in json3)
						{
							if(typeof json3[item3] =='string')
							{
								if(row2 ==null)
								{
									row2 =new Row();
									dataset.addRow(row2);
								}
								row2.put(item3, json3[item3]);
							}
						}
					}
				}
			}
		 }  
	}
	catch(e)
	{
		//alert("不符合格式要求。\n"+e);
		uni.showToast({
			title:"不符合格式要求。\n"+e,
			icon:'none',
			mask:true,
			duration:2000,
			position:'center'
		})
	}
};

Ovo.prototype.getCode=function()
{
	return this.code;
};

Ovo.prototype.getMsg=function()
{
	return this.msg;
};

Ovo.prototype.getExp=function()
{
	return this.exp;
};

Ovo.prototype.getService=function()
{
	return this.service;
};

Ovo.prototype.addParam=function(param)
{
	this.params.push(param);
	this.paramtypes.push("params");
};

Ovo.prototype.addDataSet=function(n, d)
{
	var p =new Param(n, d);
	this.params.push(p);
	this.paramtypes.push("dataset");
};

Ovo.prototype.addRow=function(n, r)
{
	var p =new Param(n, r);
	this.params.push(p);
	this.paramtypes.push("row");
};

Ovo.prototype.get=function(n,dfv)
{
	if(!isDefined(dfv))
	{
		dfv ="";
	}
	var s =null;
	if(this.params.length >0)
	{
		var defaultParams =this.getRow("params");
		if(defaultParams !=null)
		{
			s =defaultParams.get(n);
		}
		if(s !=null && typeof(s) !="undefined")
		{
			s =s.replace(/01AA01AA/g,"+");
		}
	}
	if(s ==null || s =="")
	{
		s =dfv;
	}
	if(typeof(s) =="undefined" || s =="undefined")
	{
		s =dfv;
	}
	return s;
};
Ovo.prototype.getHtml=function(n,dfv)
{
	var s =this.get(n, dfv);
	if (s.length != 0)
	{
		s = s.replace(/&/g, "&amp;"); 
		s = s.replace(/</g, "&lt;"); 
		s = s.replace(/>/g, "&gt;"); 
		s = s.replace(/ /g, "&nbsp;"); 
		s = s.replace(/\'/g, "&#39;"); 
		s = s.replace(/\"/g, "&quot;"); 
		s = s.replace(/\n/g, "<br/>"); 
	}
	return s;
};
Ovo.prototype.getRow=function(n)
{
	var s =null;
	for(var i=0; i<this.params.length; i++)
	{
		var param =this.params[i];
		if(param.name.toLowerCase() =="row:"+n.toLowerCase())
		{
			s =param.value;
			break;
		}
	}
	return s;
}
;
Ovo.prototype.getDataSet=function(n)
{
	var s =null;
	for(var i=0; i<this.params.length; i++)
	{
		var param =this.params[i];
		if(param.name.toLowerCase() =="dataset:"+n.toLowerCase())
		{
			s =param.value;
		}
	}
	return s;
};
Ovo.prototype.getIvo=function()
{
	return this.ivo;
}
;
Ovo.prototype.toString=function()
{
	var s ="service="+this.service+"; type="+this.type;
	s +="\n{";
	for(var i=0; i<this.params.length; i++)
	{
		s +="\n"+this.params[i].toString();
	}
	s +="\n}";
	return s;
};

Ovo.prototype.length=function()
{
	return this.params.length;
};

/*是否存在此参数*/
Ovo.prototype.exist=function(n)
{
	var exist =false;
	if(this.get(n, null) !=null)
	{
		exist =true;
	}
	if(!exist && this.getRow(n) !=null)
	{
		exist =true;
	}
	if(!exist && this.getDataSet(n) !=null)
	{
		exist =true;
	}
	return exist;
};

/**
 **_______DataSet 数据集处理_______
 */
DataSet=function() 
{
	this.dataset =[];
};

DataSet.prototype.addRow=function(row)
{
	this.dataset.push(row);
};

DataSet.prototype.add=function(row)
{
	this.dataset.push(row);
};

DataSet.prototype.set=function(row)
{
	this.dataset.push(row);
};

DataSet.prototype.getRow=function(row)
{
	if(this.size() <=row)
	{
		return null;
	}
	return this.dataset[row];
};

DataSet.prototype.get=function(row)
{
	if(this.size() <=row)
	{
		return null;
	}
	return this.dataset[row];
};

DataSet.prototype.toString=function()
{
	var s ="{";
	for(var i=0; i<this.dataset.length; i++)
	{
		s +="\n"+this.dataset[i].toString();
	}
	s +="\n}";
	return s;
};

DataSet.prototype.size=function()
{
	return this.dataset.length;
};

DataSet.prototype.length=function()
{
	return this.dataset.length;
};

DataSet.prototype.toJson=function()
{
	var s="";
	for(var i=0; i<this.dataset.length; i++)
	{
		if(i>0)
		{
			s +=",";
		}
		s +=this.dataset[i].toJson();
	}
	return s;
};
//获取数据集某列的值，返回数组
DataSet.prototype.getValuesByKey=function(key, order)
{
	var values =[];
	if(isDefined(order))
	{
		if(order =="desc")
		{
			for(var i=this.dataset.length -1; i>=0; i--)
			{
				var row =this.dataset[i];
				values.push(row.get(key));
			}
		}
		else
		{
			for(var i=0; i<this.dataset.length; i++)
			{
				var row =this.dataset[i];
				values.push(row.get(key));
			}
		}
	}
	else
	{
		for(var i=0; i<this.dataset.length; i++)
		{
			var row =this.dataset[i];
			values.push(row.get(key));
		}
	}
	return values;
};

/**
 **_______Row 行数据集处理_______
 */
Row=function() 
{
	this.row =[];
};

Row.prototype.put=function(p)
{
	this.row.push(p);
};

Row.prototype.size=function()
{
	return this.row.length;
};

Row.prototype.length=function()
{
	return this.row.length;
};

Row.prototype.getByIndex=function(i)
{
	var v =null;
	if(this.row.length >i)
	{
		return this.row[i]; 
	}
};

Row.prototype.put=function(n, v)
{
	var param =new Param(n, v);
	this.row.push(param);
};

Row.prototype.add=function(n, v)
{
	var param =new Param(n, v);
	this.row.push(param);
};

Row.prototype.getKeysString=function(tag)
{
	if(typeof(tag) =="undefined" || tag =="undefined")
	{
		tag ="";
	}
	var keys =[];
	var skeys =null;
	for(var i=0; i<this.row.length; i++)
	{
		var param =this.row[i];
		keys.push(param.name.toLowerCase());
	}
	if(keys.length >0)
	{
		skeys =keys.join(tag);
	}
	return skeys;
}
;
Row.prototype.getKeys=function()
{
	var keys =[];
	for(var i=0; i<this.row.length; i++)
	{
		var param =this.row[i];
		keys.push(param.name.toLowerCase());
	}
	return keys;
}
;
Row.prototype.getValues=function()
{
	var values =[];
	for(var i=0; i<this.row.length; i++)
	{
		var param =this.row[i];
		values.push(param.value);
	}
	return values;
}
;
Row.prototype.get=function(n,dfv)
{
	var s ="";
	for(var i=0; i<this.row.length; i++)
	{
		var param =this.row[i];
		if(param.name.toLowerCase() ==n.toLowerCase())
		{
			s =param.value;
			break;
		}
	}
	if(s =="")
	{
		s =dfv;
	}
	if(typeof(s) =="undefined" || s =="undefined")
	{
		s ="";
	}
	return s;
};

Row.prototype.getHtml=function(n,dfv)
{
	var s =this.get(n, dfv);
	if (s.length != 0)
	{
		s = s.replace(/&/g, "&amp;"); 
		s = s.replace(/</g, "&lt;"); 
		s = s.replace(/>/g, "&gt;"); 
		s = s.replace(/ /g, "&nbsp;"); 
		s = s.replace(/\'/g, "&#39;"); 
		s = s.replace(/\"/g, "&quot;"); 
		s = s.replace(/\n/g, "<br/>"); 
	}
	return s;
};

Row.prototype.toString=function()
{
	var s ="[";
	for(var i=0; i<this.row.length; i++)
	{
		s +="\n\t"+this.row[i].toString();
	}
	s +="\n]";
	return s;
};


Row.prototype.toHtmlString=function()
{
	var s ="[";
	for(var i=0; i<this.row.length; i++)
	{
		s +="\n\t"+this.row[i].toHtmlString();
	}
	s +="\n]";
	return s;
};
 

Row.prototype.toJson=function()
{
	var s ="{";
	for(var i=0; i<this.row.length; i++)
	{
		if(i >0)
		{
			s +=",";
		}
		s +=this.row[i].toJson();
	}
	s +="}";
	return s;
};

Row.prototype.fromJson=function(json)
{
	if(json !=null && json !="")
	{
		json =JSON.parse(json);
		for(var name in json) 
		{
			this.put(name, json[name]);
		}
	}
};

Row.prototype.size=function()
{
	return this.row.length;
};

/**
 **_______Param 参数数据集处理_______
 */
Param=function(n,v) 
{
	this.name =n;
	this.value =v;
};

Param.prototype.toString=function()
{
	return this.name+"="+this.value;
};

Param.prototype.toHtmlString=function()
{
	return "<mark>"+this.name+"</mark>="+this.value;
};

Param.prototype.toJson=function()
{
	var jsonstr =null;
	if(this.value instanceof Row)
	{
		jsonstr ="\""+this.name.toLowerCase()+"\":"+this.value.toJson();
	}
	else if(this.value instanceof DataSet)
	{
		jsonstr ="\""+this.name.toLowerCase()+"\":["+this.value.toJson()+"]";
	}
	else
	{
		jsonstr ="\""+this.name.toLowerCase()+"\":\""+this.value+"\"";
	}
	return jsonstr;
};

/**
OVO 版本2实现
*/
ParamV2=function(n, v, type) 
{
	if(n!== null && n !== undefined){
		this.name =  n.toLowerCase();
	}
	this.value =v;
	this.type =type;
};
ParamV2.prototype.toString=function()
{
	
	return this.name+"="+this.value+"，"+this.type;
};

OvoV2=function()
{
	this.ivo =null;//输入值对象
	this.params =[];//Ovo.params;
	this.result =null;
};

OvoV2.prototype.getCode=function()
{
	return this.get("code");
};
OvoV2.prototype.getMsg=function()
{
	return this.get("msg");
};
OvoV2.prototype.getExp=function()
{
	return this.get("exp");
};
OvoV2.prototype.getService=function()
{
	return this.get("service");
};
OvoV2.prototype.getIvo=function()
{
	return this.ivo;
}
;

OvoV2.prototype.push=function(param)
{
	return this.params.push(param);
};
OvoV2.prototype.length=function()
{
	return this.params.length;
};
OvoV2.prototype.getParam=function(name)
{
	name =name.toLowerCase();
	var param =null;

	for(var i=0; i<this.length(); i++)
	{	
		if(this.params[i].name == name)
		{
			
			param =this.params[i];
			break;
		}
	}
	return param;
};
OvoV2.prototype.keys =function()
{
	var keys =null;
	for(var i=0; i<this.length(); i++)
	{
		if(keys ==null)
		{
			keys =this.params[i].name;
		}
		else
		{
			keys +="," +this.params[i].name;
		}
	}
	return keys;
};
OvoV2.prototype.getString=function(name)
{
	var param =this.getParam(name);
	return param.value;
};

OvoV2.prototype.get=function(name, dfv)
{
	var param =this.getParam(name);
	if(!isDefined(dfv))
	{
		dfv ="";
	}
	return param ==null?dfv:param.value;
};

OvoV2.prototype.getIndex=function(index)
{
	return this.params[index];
};

OvoV2.prototype.getRow=function(name)
{
	
	var param =this.getParam(name);
	
	if(param !=null)
	{	
		if(param.type !="row")
		{
			//alert(name +"非行参数");
			uni.showToast({
				title:name +"非行参数",
				icon:'none',
				mask:true,
				duration:2000,
				position:'center'
			})
			throw new Error(name +"非行参数");
		}
	}
	if(param !=null)
	{
		var row =new Row();
		var value =param.value;
		for(var i=0; i<value.length(); i++)
		{
			var paramsub =value.getIndex(i);
			if(paramsub.type =="row")
			{
				var paramsubrow =param.value.getRow(paramsub.name);
				row.put(paramsub.name, paramsubrow);
			}
			else if(paramsub.type =="dataset")
			{
				var dataset =new DataSet();
				var paramsubv =paramsub.value;
				for(var ii=0; ii<paramsubv.length; ii++)
				{
					var subvalue =paramsubv[ii];//参数集
					var subvaluerow =new Row();
					for(var iii=0; iii<subvalue.length(); iii++)
					{
						var subvaluesub =subvalue.getIndex(iii);
						if(subvaluesub.type =="row")
						{
							//alert("行参数中嵌套数据集嵌套行参数又嵌入行参数暂未实现！");
							uni.showToast({
								title:'行参数中嵌套数据集嵌套行参数又嵌入行参数暂未实现!',
								icon:'none',
								mask:true,
								duration:2000,
								position:'center'
							})
						}
						else if(subvaluesub.type =="dataset")
						{
							//alert("行参数中嵌套数据集嵌套行参数又嵌入数据集参数暂未实现！");
							uni.showToast({
								title:'行参数中嵌套数据集嵌套行参数又嵌入数据集参数暂未实现!',
								icon:'none',
								mask:true,
								duration:2000,
								position:'center'
							})
						}
						else
						{
							subvaluerow.put(subvaluesub.name, subvaluesub.value);
						}
					}
					dataset.add(subvaluerow);
				}
				row.put(paramsub.name, dataset);
			}
			else
			{
				row.put(paramsub.name, paramsub.value);
			}
		}
		return row;
	}
	return null;
};

OvoV2.prototype.getDataSet=function(name)
{	
	
	var param =this.getParam(name);
	
	if(param !=null)
	{
		if(param.type != "dataset")
		{
			//alert(name +"非列表参数");
			uni.showToast({
				title:"非列表参数",
				icon:'none',
				mask:true,
				duration:2000,
				position:'center'
			})
			//throw new Error(name +"非行参数");
		}
		var dataset =new DataSet();
		var paramsubv = param.value;
		for(var ii=0; ii<paramsubv.length; ii++)
		{
			var subvalue = paramsubv[ii];//参数集
			var subvaluerow =new Row();
			for(var iii=0; iii<subvalue.length(); iii++)
			{
				var subvaluesub =subvalue.getIndex(iii);
				if(subvaluesub.type =="row")
				{
					//alert("行参数中嵌套数据集嵌套行参数又嵌入行参数暂未实现！");
					uni.showToast({
						title:'行参数中嵌套数据集嵌套行参数又嵌入行参数暂未实现！',
						icon:'none',
						mask:true,
						duration:2000,
						position:'center'
					})
				}
				else if(subvaluesub.type =="dataset")
				{
					//alert("行参数中嵌套数据集嵌套行参数又嵌入数据集参数暂未实现！");
					uni.showToast({
						title:'行参数中嵌套数据集嵌套行参数又嵌入数据集参数暂未实现!',
						icon:'none',
						mask:true,
						duration:2000,
						position:'center'
					})
				}
				else
				{	
					
					subvaluerow.put(subvaluesub.name, subvaluesub.value);
				}
			}
			dataset.add(subvaluerow);
		}
		return dataset;
	}
	else
	{
		return null;
	}
};
/*是否存在此参数*/
OvoV2.prototype.exist=function(n)
{
	var exist =false;
	if(this.get(n, null) !=null)
	{
		exist =true;
	}
	if(!exist && this.getRow(n) !=null)
	{
		exist =true;
	}
	if(!exist && this.getDataSet(n) !=null)
	{
		exist =true;
	}
	return exist;
};


//是否已经定义参数
function isDefined(param)
{
	var defined =false;
	try
	{
		defined =!(typeof param == "undefined");
	}
	catch (e)
	{
		defined =false;
	}
	return defined;
}
